home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / ck5a189s / ckcnet.h < prev    next >
C/C++ Source or Header  |  1993-06-04  |  11KB  |  411 lines

  1. /* ckcnet.h -- Symbol and macro definitions for C-Kermit network support */
  2.  
  3. /*
  4.   Author: Frank da Cruz (fdc@columbia.edu, FDCCU@CUVMA.BITNET),
  5.   Columbia University Academic Information Systems, New York City.
  6.  
  7.   Copyright (C) 1985, 1993, Trustees of Columbia University in the City of New
  8.   York.  The C-Kermit software may not be, in whole or in part, licensed or
  9.   sold for profit as a software product itself, nor may it be included in or
  10.   distributed with commercial products or otherwise distributed by commercial
  11.   concerns to their clients or customers without written permission of the
  12.   Office of Kermit Development and Distribution, Columbia University.  This
  13.   copyright notice must not be removed, altered, or obscured.
  14. */
  15. #ifndef CKCNET_H
  16. #define CKCNET_H
  17.  
  18. /* Network types */
  19.  
  20. #define NET_NONE 0            /* None */
  21. #define NET_TCPB 1            /* TCP/IP Berkeley (socket) */
  22. #define NET_TCPA 2            /* TCP/IP AT&T (streams) */
  23. #define NET_SX25 3            /* SUNOS SunLink X.25 */
  24. #define NET_DEC  4            /* DECnet */
  25. #define NET_VPSI 5            /* VAX PSI */
  26. #define NET_PIPE 6            /* LAN Manager Named Pipe */
  27.  
  28. /* Network virtual terminal protocols */
  29.  
  30. #define NP_NONE 0            /* None (async) */
  31. #define NP_TELNET 1            /* TCP/IP telnet */
  32. #define NP_VTP 2            /* ISO Virtual Terminal Protocol */
  33. #define NP_X3 3                /* CCITT X.3 */
  34. #define NP_X28 4            /* CCITT X.28 */
  35. #define NP_X29 5            /* CCITT X.28 */
  36. #define NP_CTERM 20            /* DEC CTERM */
  37. #define NP_LAT 21            /* DEC LAT */
  38. /* others here... */
  39.  
  40. /* Basic network function prototypes, common to all. */
  41.  
  42. _PROTOTYP( int netopen, (char *, int *, int) );
  43. _PROTOTYP( int netclos, (void) );
  44. _PROTOTYP( int netflui, (void) );
  45. _PROTOTYP( int nettchk, (void) );
  46. _PROTOTYP( int netbreak, (void) );
  47. _PROTOTYP( int netinc, (int) );
  48. _PROTOTYP( int nettol, (char *, int) );
  49. _PROTOTYP( int nettoc, (char) );
  50.  
  51. /*
  52.   SunLink X.25 support by Marcello Frutig, Catholic University,
  53.   Rio de Janeiro, Brazil, 1990.
  54.  
  55.   Maybe this can be adapted to VAX PSI and other X.25 products too.
  56. */
  57. #ifndef SUNOS4                /* Only valid for SUNOS4 */
  58. #ifdef SUNX25
  59. #undef SUNX25
  60. #endif /* SUNX25 */
  61. #endif /* SUNOS4 */
  62.  
  63. #ifdef SUNX25
  64.  
  65. #ifndef NETCONN                /* SUNX25 implies NETCONN */
  66. #define NETCONN
  67. #endif /* NETCONN */
  68.  
  69. #define MAXPADPARMS                18    /* Number of PAD parameters */
  70. #define MAXCUDATA           12    /* Max length of X.25 call user data */
  71. #define X29PID                1   /* X.29 protocol ID */
  72. #define X29PIDLEN            4   /* X.29 protocol ID length */
  73.  
  74. #define X29_SET_PARMS               2
  75. #define X29_READ_PARMS              4
  76. #define X29_SET_AND_READ_PARMS      6
  77. #define X29_INVITATION_TO_CLEAR     1
  78. #define X29_PARAMETER_INDICATION    0
  79. #define X29_INDICATION_OF_BREAK     3
  80. #define X29_ERROR                   5
  81.  
  82. #define INVALID_PAD_PARM            1
  83.  
  84. #define PAD_BREAK_CHARACTER         0
  85.  
  86. #define PAD_ESCAPE                  1
  87. #define PAD_ECHO                    2
  88. #define PAD_DATA_FORWARD_CHAR       3
  89. #define PAD_DATA_FORWARD_TIMEOUT    4
  90. #define PAD_FLOW_CONTROL_BY_PAD     5
  91. #define PAD_SUPPRESSION_OF_SIGNALS  6
  92. #define PAD_BREAK_ACTION            7
  93. #define PAD_SUPPRESSION_OF_DATA     8
  94. #define PAD_PADDING_AFTER_CR        9
  95. #define PAD_LINE_FOLDING           10
  96. #define PAD_LINE_SPEED             11
  97. #define PAD_FLOW_CONTROL_BY_USER   12
  98. #define PAD_LF_AFTER_CR            13
  99. #define PAD_PADDING_AFTER_LF       14
  100. #define PAD_EDITING                15
  101. #define PAD_CHAR_DELETE_CHAR       16
  102. #define PAD_BUFFER_DELETE_CHAR     17
  103. #define PAD_BUFFER_DISPLAY_CHAR    18
  104.  
  105. #define MAXIX25 MAX_USER_DATA*7
  106. #define MAXOX25 MAX_USER_DATA
  107.  
  108. #include <sys/ioctl.h>            /* X.25 includes */
  109. #include <sys/param.h>
  110. #include <sys/systm.h>
  111. #include <sys/mbuf.h>
  112. #include <sys/socket.h>
  113. #include <sys/protosw.h>
  114. #include <sys/domain.h>
  115. #include <sys/socketvar.h>
  116. #include <net/if.h>
  117. #include <sundev/syncstat.h>
  118. #include <netx25/x25_pk.h>
  119. #include <netx25/x25_ctl.h>
  120. #include <netx25/x25_ioctl.h>
  121.  
  122. /* C-Kermit X.3 / X.25 / X.29 / X.121 support functions */
  123.  
  124. _PROTOTYP( VOID shopad, (void) );
  125. _PROTOTYP( VOID initpad, (void) );
  126. _PROTOTYP( VOID setpad, (CHAR *, int) );
  127. _PROTOTYP( VOID readpad, (CHAR *, int, CHAR *) );
  128. _PROTOTYP( int qbitpkt, (CHAR *, int) );
  129. _PROTOTYP( VOID setqbit, (void) );
  130. _PROTOTYP( VOID resetqbit, (void) );
  131. _PROTOTYP( VOID breakact, (void) );
  132. _PROTOTYP( int pkx121, (char *, CHAR *) );
  133. _PROTOTYP( VOID x25oobh, (void) );
  134. _PROTOTYP( int x25diag, (void) );
  135. _PROTOTYP( int x25intr, (char) );
  136. _PROTOTYP( int x25reset, (char, char) );
  137. _PROTOTYP( int x25clear, (void) );
  138. _PROTOTYP( int x25stat, (void) );
  139. _PROTOTYP( int x25in, (int, CHAR *) );
  140. _PROTOTYP( int x25inl, (CHAR *, int, int, CHAR) );
  141.  
  142. #endif /* SUNX25 */
  143.  
  144. /* DEC TCP/IP for (Open)VMS, previously known as UCX */
  145.  
  146. #ifdef DEC_TCPIP            /* DEC_TCPIP implies TCPSOCKET */
  147. #ifndef TCPSOCKET
  148. #define TCPSOCKET
  149. #endif /* TCPSOCKET */
  150. #ifndef TCPIPLIB
  151. #define TCPIPLIB
  152. #endif /* TCPIPLIB */
  153. #endif /* DEC_TCPIP */
  154.  
  155. /* TGV/SRI MultiNet, TCP/IP for VAX/VMS */
  156.  
  157. #ifdef MULTINET                /* MULTINET implies TCPSOCKET */
  158. #ifndef TCPSOCKET
  159. #define TCPSOCKET
  160. #endif /* TCPSOCKET */
  161. #ifndef TCPIPLIB
  162. #define TCPIPLIB
  163. #endif /* TCPIPLIB */
  164. #ifndef TGVORWIN            /* MULTINET and WINTCP */
  165. #define TGVORWIN            /* share a lot of code... */
  166. #endif /* TGVORWIN */
  167. #endif /* MULTINET */
  168.  
  169. /* Wollongong TCP/IP for VAX/VMS */
  170.  
  171. #ifdef WINTCP                /* WINTCP implies TCPSOCKET */
  172. #ifndef TCPSOCKET
  173. #define TCPSOCKET
  174. #endif /* TCPSOCKET */
  175. #ifndef TCPIPLIB
  176. #define TCPIPLIB
  177. #endif /* TCPIPLIB */
  178. #ifndef TGVORWIN            /* WINTCP and MULTINET */
  179. #define TGVORWIN            /* share a lot of code... */
  180. #endif /* TGVORWIN */
  181. #endif /* WINTCP */
  182.  
  183. /* Wollongong TCP/IP for AT&T Sys V */
  184.  
  185. #ifdef WOLLONGONG            /* WOLLONGONG implies TCPSOCKET */
  186. #ifndef TCPSOCKET            /* Don't confuse WOLLONGONG */
  187. #define TCPSOCKET            /* (which is for UNIX) with */
  188. #endif /* TCPSOCKET */            /* WINTCP, which is for VMS! */
  189. #endif /* WOLLONGONG */
  190.  
  191. #ifdef EXCELAN                /* EXCELAN implies TCPSOCKET */
  192. #ifndef TCPSOCKET
  193. #define TCPSOCKET
  194. #endif /* TCPSOCKET */
  195. #endif /* EXCELAN */
  196.  
  197. #ifdef INTERLAN                /* INTERLAN implies TCPSOCKET */
  198. #ifndef TCPSOCKET
  199. #define TCPSOCKET
  200. #endif /* TCPSOCKET */
  201. #endif /* INTERLAN */
  202.  
  203. /* Telnet protocol */
  204.  
  205. #ifdef TCPSOCKET            /* TCPSOCKET implies TNCODE */
  206. #ifndef TNCODE                /* Which means... */
  207. #define TNCODE                /* Compile in telnet code */
  208. #endif /* TNCODE */
  209. #endif /* TCPSOCKET */
  210.  
  211. #ifdef SUNX25                /* SUNX25 implies TCPSOCKET */
  212. #ifndef TCPSOCKET            /* But doesn't imply TNCODE */
  213. #define TCPSOCKET
  214. #endif /* TCPSOCKET */
  215. #endif /* SUNX25 */
  216.  
  217. /* This is the TCPSOCKET section... */
  218.  
  219. #ifdef TCPSOCKET
  220.  
  221. #ifndef NETCONN                /* TCPSOCKET implies NETCONN */
  222. #define NETCONN
  223. #endif /* NETCONN */
  224.  
  225. /* BSD sockets library header files */
  226.  
  227. #ifdef UNIX                /* UNIX section */
  228.  
  229. #ifdef INTERLAN                /* Racal-Interlan TCP/IP */
  230. #include <interlan/socket.h>
  231. #include <interlan/il_types.h>
  232. #include <interlan/telnet.h>
  233. #include <interlan/il_errno.h>
  234. #include <interlan/in.h>
  235. #include <interlan/telnet.h>
  236. #else                    /* Normal BSD TCP/IP library */
  237. #ifndef HPUX
  238. #include <arpa/telnet.h>
  239. #endif /* HPUX */
  240. #include <sys/socket.h>
  241. #ifdef WOLLONGONG
  242. #include <sys/in.h>
  243. #else
  244. #include <netinet/in.h>
  245. #endif /* WOLLONGONG */
  246. #endif /* INTERLAN */
  247.  
  248. #ifndef EXCELAN
  249. #include <netdb.h>
  250. #ifndef INTERLAN
  251. #ifdef WOLLONGONG
  252. #define minor                /* Do not include <sys/macros.h> */
  253. #include <sys/inet.h>
  254. #else
  255. #ifndef OXOS
  256. #ifndef HPUX
  257. #include <arpa/inet.h>
  258. #endif /* HPUX */
  259. #else /* OXOS */
  260. /* In too many releases of X/OS, <arpa/inet.h> declares inet_addr() as
  261.  * ``struct in_addr''.  This is definitively wrong, and could cause
  262.  * core dumps.  Instead of including that bad file, inet_addr() is
  263.  * correctly declared here.  Of course, all the declarations done there
  264.  * has been copied here.
  265.  */
  266. unsigned long inet_addr();
  267. char    *inet_ntoa();
  268. struct    in_addr inet_makeaddr();
  269. unsigned long inet_network();
  270. #endif /* OXOS */
  271. #endif /* WOLLONGONG */
  272. #endif /* INTERLAN */
  273. #endif /* EXCELAN */
  274.  
  275. #ifdef EXCELAN                /* Excelan TCP/IP */
  276. #include <ex_errno.h>
  277. #endif /* EXCELAN */
  278.  
  279. #ifdef I386IX                /* Interactive Sys V R3 network. */
  280. /* #define TELOPTS */            /* This might need defining. */
  281. #define ORG_NLONG ENAMETOOLONG        /* Resolve conflicting symbols */
  282. #undef ENAMETOOLONG            /* in <errno.h> and <net/errno.h> */
  283. #define ORG_NEMPTY ENOTEMPTY
  284. #undef ENOTEMPTY
  285. #include <net/errno.h>
  286. #undef ENAMETOOLONG
  287. #define ENAMETOOLONG ORG_NLONG
  288. #undef ENOTEMPTY
  289. #define ENOTEMPTY ORG_NEMPTY
  290. #endif /* I386IX */
  291. /*
  292.   Data type of the inet_addr() function...
  293.   We define INADDRX if it is of type struct inaddr.
  294.   If it is undefined, unsigned long is assumed.
  295.   Look at <arpa/inet.h> to find out.  The following known cases are
  296.   handled here.  Other systems that need it can be added here, or else
  297.   -DINADDRX can be included in the CFLAGS on the cc command line.
  298. */
  299. #ifdef DGUX540                /* Data General UX 5.40 */
  300. #define INADDRX
  301. #endif /* DGUX540 */
  302. #ifdef DU2                /* DEC Ultrix 2.0 */
  303. #define INADDRX
  304. #endif /* DU2 */
  305.  
  306. #else /* Not UNIX */
  307.  
  308. #ifdef VMS                /* VAX/VMS section */
  309.  
  310. #ifdef WINTCP                /* TWG WIN/TCP for VMS */
  311. #include <errno.h>
  312. #include "twg$tcp:[netdist.include.sys]types.h"
  313. #include "twg$tcp:[netdist.include.sys]socket.h"
  314. #include "twg$tcp:[netdist.include]netdb.h"
  315. #include "twg$tcp:[netdist.include.sys]domain.h"
  316. #include "twg$tcp:[netdist.include.sys]protosw.h"
  317. #include "twg$tcp:[netdist.include.netinet]in.h"
  318. #include "twg$tcp:[netdist.include.sys]ioctl.h"
  319. #endif /* WINTCP */
  320.  
  321. #ifdef MULTINET                /* TGV MultiNet */
  322. #include "multinet_root:[multinet.include]errno.h"
  323. #include "multinet_root:[multinet.include.sys]types.h"
  324. #include "multinet_root:[multinet.include.sys]socket.h"
  325. #include "multinet_root:[multinet.include]netdb.h"
  326. #include "multinet_root:[multinet.include.netinet]in.h"
  327. #include "multinet_root:[multinet.include.sys]ioctl.h"
  328. #endif /* MULTINET */
  329.  
  330. #ifdef DEC_TCPIP
  331. #include <in.h>
  332. #include <netdb.h>
  333. #include <socket.h>
  334. #include "ckvioc.h"
  335. #define socket_errno errno
  336. #define bzero(s,n) memset(s,0,n) 
  337. #define bcopy(h,a,l) memmove(a,h,l)
  338. #define socket_read     read
  339. #define socket_write     write
  340. #define socket_ioctl    ioctl
  341. #define socket_close    close
  342. #endif /* DEC_TCPIP */
  343.  
  344. #else /* Not VMS */
  345.  
  346. #ifdef OS2
  347. #include "ckonet.h"
  348. #endif /* OS2 */
  349.  
  350. #endif /* VMS */
  351. #endif /* UNIX */
  352. #endif /* TCPSOCKET */
  353.  
  354. #ifdef TNCODE                /* If we're compiling telnet code... */
  355. /*
  356.   Make sure telnet symbols are defined; can't rely on library header files
  357.   for any of them.
  358. */
  359. #ifndef IAC                /* First the telnet commands */
  360. #define IAC 255
  361. #endif /* IAC */
  362. #ifndef DONT
  363. #define DONT 254
  364. #endif /* DONT */
  365. #ifndef DO
  366. #define DO 253
  367. #endif /* DO */
  368. #ifndef WONT
  369. #define WONT 252
  370. #endif /* WONT */
  371. #ifndef WILL
  372. #define WILL 251
  373. #endif /* WILL */
  374. #ifndef SB
  375. #define SB 250
  376. #endif /* SB */
  377. #ifndef BREAK
  378. #define BREAK 243
  379. #endif /* BREAK */
  380. #ifndef SE
  381. #define SE 240
  382. #endif /* SE */
  383.  
  384. #ifndef TELOPT_ECHO            /* Then the options */
  385. #define TELOPT_ECHO 1
  386. #endif /* TELOPT_ECHO */
  387. #ifndef TELOPT_SGA
  388. #define    TELOPT_SGA 3
  389. #endif /* TELOPT_SGA */
  390. #ifndef TELOPT_STATUS
  391. #define    TELOPT_STATUS 5
  392. #endif /* TELOPT_STATUS */
  393. #ifndef TELOPT_TTYPE
  394. #define    TELOPT_TTYPE 24
  395. #endif /* TELOPT_TTYPE */
  396. #ifndef NTELOPTS
  397. #define    NTELOPTS 24
  398. #endif /* NTELOPTS */
  399.  
  400. /* Telnet protocol functions defined in C-Kermit */
  401.  
  402. _PROTOTYP( int tn_ini, (void) );    /* Telnet protocol support */
  403. _PROTOTYP( int tn_sopt, (int, int) );
  404. _PROTOTYP( int tn_doop, (CHAR, int, int (*)(int) ) );
  405. _PROTOTYP( int tn_sttyp, (void) );
  406. _PROTOTYP( int tnsndbrk, (void) );
  407.  
  408. #endif /* TNCODE */
  409.  
  410. #endif /* CKCNET_H */
  411.